<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>详情</title>
<link href="{{url('/css/home/news/templatemo_style.css')}}" rel="stylesheet" type="text/css" />
<style>
    h3{
        margin-top:30px;
    }
</style>
<script language="javascript" type="text/javascript">
    function clearText(field)
    {
        if (field.defaultValue == field.value) field.value = '';
        else if (field.value == '') field.value = field.defaultValue;
    }
</script>

<link rel="stylesheet" type="text/css" href="{{url('/css/home/news/ddsmoothmenu.css')}}" />

<script type="text/javascript" src="{{url('/js/jquery.min.js')}}"></script>
<script type="text/javascript" src="{{url('/js/home/news/ddsmoothmenu.js')}}">
</script>

<script type="text/javascript">

ddsmoothmenu.init({
	mainmenuid: "templatemo_menu", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script>
</head>
<body>
<div id="templatemo_wrapper">
	<div id="templatemo_header">
    	<div id="site_title">
        	<h1><a href="#">Free CSS Templates</a></h1>
        </div>
        <div id="templatemo_menu" class="ddsmoothmenu">
            <ul>
              	<li><a href="{{url('/')}}">首页</a></li>
          		
          		<li><a href="{{url('/')}}">新闻列表</a>
                    <!-- <ul>
                        <li><a href="">新闻详情</a></li>
                  	</ul> -->
              	</li>
            </ul>
            <br style="clear: left" />
        </div> <!-- end of templatemo_menu -->
    </div> <!-- end of header -->    
    <div id="content_top">
        <div id="page_title">新闻详情</div>
        <div id="search_box">
            <form action="#" method="get">
                <input type="text" value="Search" name="q" size="10" id="searchfield" title="searchfield" onfocus="clearText(this)" onblur="clearText(this)" />
                <input type="submit" name="Search" value="" id="searchbutton" title="Search" />
            </form>
        </div>
        <div class="cleaner"></div>
    </div>      
    <div id="templatemo_content">
    	<div class="post_box">
            <h2>{{$data->title}}</h2>
            <img src="/imgs/home/news/templatemo_image_06.jpg"  alt="Image" />
            <p><em>{{$data->createtime}}</em></p>
            <p align="justify">{!! $data->content !!}</p>
		</div>        
        <div class="cleaner"></div>
                <h3>所有评论</h3>                        
              <div id="comment_section">
                <ol class="comments first_level"> 
                        @if(!empty($menu_list)) 
                		@foreach($menu_list as $v_menu)   
                        <li>
                            <div class="comment_box commentbox1">                                   
                                <div class="gravatar">
                                    <img src="/imgs/home/news/avator.jpg" alt="author 6" />
                                </div>                                
                                <div class="comment_text">
                                    <div class="comment_author">{{$v_menu['user_name']}}<span class="date">{{ $v_menu['createtime'] }}</span></div>
                                    <p>{!! $v_menu['comment'] !!}</p>
                                  <div class="reply"><a class ="btn_reply" comment_id ="{{$v_menu['id']}}" user="{{$v_menu['user_name']}}">回复 {{$v_menu['user_name']}}/{{$id = $v_menu['id']}}</a></div>
                                </div>
                                <div class="cleaner"></div>
                            </div>                                                    
                        </li>
                            
                            
                            <li>
                               	<ol class="comments">
                                        <li>
                                            <div class="comment_box commentbox2">
                                                <div class="gravatar">
                                                    <img src="/imgs/home/news/avator.jpg" alt="author 5"/>
                                                </div>
                                                <div class="comment_text">
                                                    <div class="comment_author">{{$v_menu['user_name']}}@回复的谁 <span class="date">November 22, 2048</span> <span class="time">09:33 am</span></div>
                                                    <p>Suspendisse facilisis nisl a purus pulvinar convallis. Fusce aliquet, lorem ut auctor gravida, mauris orci fermentum felis, nec vehicula ligula lacus sed ipsum.</p>
                                                    <!-- <div class="reply"><a href="#">Reply</a></div> -->
                                                </div>
                                                <div class="cleaner"></div>
                                            </div>  
                                        </li>                                 
                                    </ol>                               
    						</li>
                             
                        @endforeach
                        @endif         
                </ol>
                <!-- 回复评论 -->
                <input type="hidden" name="_token" value="{{csrf_token()}}" id="token">    
          		<div class="templatemo_paging" style="display: none;">
            		<textarea  name="reply_comment" id="text_replay"  rows="10" cols="35" placeholder="@写下您的回复评论吧"></textarea><br>
                    <button type='button' class="sub_btn">提交回复评论</button>
            	</div>
                     
                <div class="cleaner h20"></div>
                
                <div id="comment_form">
                    <h3>{{$user_name}}写下您的评论吧:</h3>
                    
                    <form action="#" method="get">
						<!-- <div class="form_row">
							<label>Name (* required)</label><br />
							<input type="text" name="name" />
						</div>
						<div class="form_row">
							<label>Email  (* required)</label><br />
							<input type="text" name="name" />
						</div> -->
						<div class="form_row">
						<input type="hidden" name="_token" value="{{csrf_token()}}" id="token">
							<label>Comment</label><br/>
							<textarea  name="comment" id="text" rows="" cols="" placeholder="写下您的评论吧"></textarea>
						</div>
						<input type="button" name="comment_btn" value="发表评论" class="comment_btn" />             
					</form>     
            	</div>
    </div> <!-- end of content -->
    <div id="templatemo_sidebar">
        <div class="sb_box">
        	<h3>Categories</h3>
            <ul class="sb_list">
            	<li><a href="#">Aliquam fermentum et</a></li>
                <li><a href="#">Donec faucibus accumsan</a></li>
                <li><a href="#">Fusce malesuada interdum</a></li>
                <li><a href="#">Integer vel purus at dolor</a></li>
                <li><a href="#">Phasellus auctor rhoncus</a></li>
			</ul>
        </div>
	</div> <!-- end of sidebar -->
    <div class="cleaner"></div>
    <div id="templatemo_footer">
    	Copyright © 2048 <a href="#">哈哈的新闻详情</a> | Template from <a href="#" target="_parent" title="网站模板">网站模板</a>
    </div>
</div>
<script>
$(function(){
    //评论
	$('.comment_btn').click(function(){
		if($('#text').val() == '') {
			alert('评论内容不能为空');
			return false;
		}
		var content = $('#text').val();
		var data = {
				content:content,
				news_id:{{$data->id}},
		};
		data['_token'] = $('#token').val();
		var url = '/comment/comment';
		$.post(url,data,function(rest){
			alert('发表评论成功');
			location.replace(location.href);
		});
	});
    //回复评论
    $('.btn_reply').click(function(){
        var comment_id = $(this).attr('comment_id');
        var user = $(this).attr('user');
        $('.templatemo_paging').css('display','block');
        $('#text_replay').attr('placeholder','@'+user);
        $('.sub_btn').click(function(){
        if($('#text_replay').val() == '') {
            alert('回复评论内容不能为空');
            return false;
        }
        var content = $('#text_replay').val();
        var data = {
                content:content,
                name:name,
                id:comment_id,
                news_id:{{$data->id}},
        };
        data['_token'] = $('#token').val();
        var url = '/comment/reply';
        $.post(url,data,function(rest){
            alert('发表回复评论成功');
            location.replace(location.href);
        });
    });  
       
   });
});

</script>

</body>
</html>
